spectrum_filter_design Module



Functions

public pure function butterworth_filter_order(fp, fs, fstop, apass, astop, ftype) result(n)

Computes the minimum order of a Butterworth low-pass or high-pass filter.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: fp

The passband edge frequency, in Hz.

real(kind=real64), intent(in) :: fs

The sampling frequency, in Hz.

real(kind=real64), intent(in) :: fstop

The stopband edge frequency, in Hz.

real(kind=real64), intent(in) :: apass

The maximum passband attenuation, in dB.

real(kind=real64), intent(in) :: astop

The minimum stopband attenuation, in dB.

integer(kind=int32), intent(in), optional :: ftype

LOW_PASS_FILTER (default) or HIGH_PASS_FILTER.

Return Value integer(kind=int32)

The minimum filter order.

public pure function filter_frequency_response(b, a, f, fs) result(rst)

Computes the complex frequency response of a rational filter.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: b(:)

The numerator coefficients of the rational transfer function.

real(kind=real64), intent(in) :: a(:)

The denominator coefficients of the rational transfer function.

real(kind=real64), intent(in) :: f(:)

The frequencies at which to evaluate the response, in Hz.

real(kind=real64), intent(in) :: fs

The sampling frequency, in Hz.

Return Value complex(kind=real64), allocatable, (:)

The complex frequency response at each frequency in f.


Subroutines

public pure subroutine design_fir_filter(n, fc, fs, b, a, fc2, ftype, win)

Designs a windowed, linear-phase FIR filter.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: n

The requested number of taps. Even values are increased by one.

real(kind=real64), intent(in) :: fc

The first cutoff frequency, in Hz.

real(kind=real64), intent(in) :: fs

The sampling frequency, in Hz.

real(kind=real64), intent(out), allocatable :: b(:)

The numerator coefficients of the designed filter.

real(kind=real64), intent(out), allocatable :: a(:)

The denominator coefficients. This is always [1.0].

real(kind=real64), intent(in), optional :: fc2

The second cutoff frequency for band-pass and band-stop filters.

integer(kind=int32), intent(in), optional :: ftype

The filter type. The default is LOW_PASS_FILTER.

class(window), intent(inout), optional, target :: win

The window function. The default is a Hamming window.

public pure subroutine design_iir_filter(n, fc, fs, b, a, ftype)

Designs an nth-order Butterworth IIR low-pass or high-pass filter.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: n

The Butterworth filter order.

real(kind=real64), intent(in) :: fc

The cutoff frequency, in Hz.

real(kind=real64), intent(in) :: fs

The sampling frequency, in Hz.

real(kind=real64), intent(out), allocatable :: b(:)

The numerator coefficients of the designed filter.

real(kind=real64), intent(out), allocatable :: a(:)

The denominator coefficients of the designed filter.

integer(kind=int32), intent(in), optional :: ftype

LOW_PASS_FILTER (default) or HIGH_PASS_FILTER.